<?php defined('SYSPATH') or die('No direct access allowed.');

class Model_User_Education extends ORM {

	// Relationships
	protected $_belongs_to = array('user' => array());
        
                 // Rules
        public function rules()
	{
		return array(
                        'degree' => array(
				array('not_empty'),
			),
			'school' => array(
				array('not_empty'),
				array('max_length', array(':value', 255)),
			),
                        'faculty' => array(
				array('not_empty'),
				array('max_length', array(':value', 255)),                        
			),                    
                        'date_start' => array(
				array('not_empty'),
				array('date'),                      
			),
                        'date_end' => array(
				array('date'),                      
			),
		);
	}
        
        public function filters()
	{
		return array(
                        'degree' => array(                              
				array(array('Security', 'xss_clean')),
                                array('trim')
			),
			'school' => array(
                                //xss clean
				array(array('Security', 'xss_clean')),
                                array('trim')
			),
                        'faculty' => array(
                                array(array('Security', 'xss_clean')),
                                array('trim')
                        ),
                        'date_start' => array(
                                array(array('Security', 'xss_clean'))
                        ),
                        //'date_end' => array(
				//array(array('Security', 'xss_clean'))
			//),                        
		);
	}

	/**
	 * Labels for fields in this model
	 *
	 * @return array Labels
	 */
	public function labels()
	{
		return array(
			'degree'      => __('Degree'),
			'school'    => __('School name'),
			'faculty'    => __('Faculty'),
                        'date_start' => __('Start date'),
			'date_end'   => __('End date'),
		);
	}
}
